#!D:\Python27\python.exe
# -*- coding: utf-8 -*-
'''
    Implements get random number request command.

    :copyright: (c) 2014 by Duxin.
'''

import cgi
import random

import command
import app
import sessions

class Random(command.Command):
    '''
        generates a random number, puts it into current session and sends it back to client.
        this command is publicly accessible.
    '''
    
    def is_param_right(self):  
        pass  

    def execute(self):
        session = self.get_session()
        
        ran = random.randint(0, 99999999)
        
        session.set_attribute('random_num', ran)
        
        return ran

app.App.start(Random())
